package com.wwz.controller;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author wwz
 */
@ControllerAdvice
public abstract class BaseController {

    @ExceptionHandler(value = Throwable.class)
    public Object ex(Throwable throwable){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("isSuccess","no");
        jsonObject.put("msg",throwable.getMessage());
        return jsonObject;
    }

}
